home *** CD-ROM | disk | FTP | other *** search
Wrap
head 1.2; branch ; access ; symbols ; locks ; strict; comment @@; 1.2 date 92.03.29.12.14.23; author death; state Exp; branches ; next 1.1; 1.1 date 92.03.22.15.47.49; author death; state Exp; branches ; next ; desc @This is the definition of the reply object. Really, i'd have to say it's an experimental object. I dunno how much I'm going to like it. But I forsee some revision ahead if I end up making serious use of it. @ 1.2 log @ turns out that 2.0 wants init calls to be in the object, not the class. Modified accordingly. @ text @/* ==================================================================== This is the implementation file for the reply class. Full documentation for this class can be found in the Reply.rtf file. I will not duplicate all that fine information here. This is $Revision: 1.1 $ of this file It was last modified by $Author: death $ on $Date: 92/03/22 15:47:49 $ Note that this file was created while using the New Century Schoolbook Roman typeface. You may find that some things line up strangely if you don't use that family. $Log: Reply.m,v $ Revision 1.1 92/03/22 15:47:49 death Initial revision ==================================================================== */ // // Import our own definition // #import "Reply.h" #import <strings.h> #import <stdlib.h> @@implementation Reply /********************************************************************************** This is the main initalization method. It initalizes the errorinfo part of itself, and then initalizes the data parts.. **********************************************************************************/ - (id) initReplyWithCode: (long int) code Text: (Cstring) text Kind: (long int) kind Data: (void*) dataVal Type: (int) theType { [super initErrorWithCode: code Text: text Kind: kind]; dataType = theType; theData = 0L; theData = (unsigned long int) dataVal; return self; } /********************************************************************************** This just calls initReplyWithCode:Text:Kind:Data:Type: with its given parameters. **********************************************************************************/ - (id) initReplyWithCode: (long int) code Text: (Cstring) text Data: (void*) dataVal Type: (int) theType { return [self initReplyWithCode: code Text: text Kind: ERRKIND_GENERAL Data: dataVal Type: theType]; } /********************************************************************************** This just calls initReplyWithCode:Text:Kind:Data:Type: with its given parameters. **********************************************************************************/ - (id) initReplyWithCode: (long int) code Text: (Cstring) text Data: (void*) dataVal { return [self initReplyWithCode: code Text: text Kind: ERRKIND_GENERAL Data: dataVal Type: TYPE_GENERAL]; } /********************************************************************************* In this method, we merely free the object. This action involves getting rid of the text string if it is there, and then asking our superclass to free. **********************************************************************************/ - free { if (dataType == TYPE_CSTRING) free((char*) theData); return [super free]; } /********************************************************************************* Returns data as if it were a byte. **********************************************************************************/ - (byte) getByte { return (byte) theData; } /********************************************************************************* Returns data as if it were a character. **********************************************************************************/ - (char) getChar { return (char) theData; } /********************************************************************************* Make a copy of the string and return it to the caller. If this string is null, this all works transparently anyay. **********************************************************************************/ - (Cstring) getCstring { Cstring tempString; // Allocate as much space as the length of the string +1 // tempString = (Cstring) malloc (strlen((char*) theData) + 1); // Make a copy of the error text into the new location // if (tempString != NULL) (void) strcpy(tempString, (char*) theData); // we don't care about getting a pointer back // Finally, return a pointer to this new string. // return tempString; } /********************************************************************************* Returns data as if it were a genral data type. **********************************************************************************/ - (void*) getGeneral { return (void*) theData; } /********************************************************************************* Returns data as if it were a genral data type. **********************************************************************************/ - (short) getShort { return (short) theData; } /********************************************************************************* Returns data as if it were a int data type. **********************************************************************************/ - (int) getInt { return (int) theData; } /********************************************************************************* Returns data as if it were a long data type. **********************************************************************************/ - (long) getLong { return (long) theData; } /********************************************************************************* Returns data as if it were an object. **********************************************************************************/ - (id) getObject { return (id) theData; } /********************************************************************************* Returns data as if it were a genral data type. **********************************************************************************/ - (unsigned short) getUnsignedShort { return (unsigned short) theData; } /********************************************************************************* Returns data as if it were a int data type. **********************************************************************************/ - (unsigned int) getUnsignedInt { return (unsigned int) theData; } /********************************************************************************* Returns data as if it were a long data type. **********************************************************************************/ - (unsigned long) getUnsignedLong { return (unsigned long) theData; } @@end @ 1.1 log @Initial revision @ text @d4 2 a5 2 This is $Revision: 1.2 $ of this file It was last modified by $Author: death $ on $Date: 92/02/09 18:40:15 $ d7 3 a9 1 $Log: ErrorInfo.m,v $ d11 1 d29 1 a29 1 + (id) initReplyWithCode: (long int) code Text: (Cstring) text Kind: (long int) kind d43 1 a43 1 + (id) initReplyWithCode: (long int) code Text: (Cstring) text Data: (void*) dataVal Type: (int) theType d56 1 a56 1 + (id) initReplyWithCode: (long int) code Text: (Cstring) text Data: (void*) dataVal d70 1 a70 1 + free @